package com.example.demo.service.impl;

import com.example.demo.domain.Role;
import com.example.demo.domain.UserRole;
import com.example.demo.mapper.UserRoleMapper;
import com.example.demo.service.IUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserRoleServiceImpl implements IUserRoleService {

    @Autowired
    private UserRoleMapper userRoleMapper;

    @Override
    public void addUserRole(UserRole userRole) {
        userRoleMapper.addUserRole(userRole);
    }

    @Override
    public UserRole getByUserIdAndRoleId(Long userId, Long roleId) {
        return userRoleMapper.getByUserIdAndRoleId(userId,roleId);
    }

    @Override
    public List<Role> getRoleByUserId(Long roleId) {
        return userRoleMapper.getRoleByUserId(roleId);
    }
}
